
using System.Threading;
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Collections.Generic;
namespace com.tc.gateway.tunnel
{

    public class MultiConnection
    {
        protected MultiCast server;
        MultiCast client;
        bool isserver;
        public MultiConnection(bool beserver)
        {

            this.isserver = beserver;
            server = new MultiCast("228.9.6.8", 8888, isserver);
            client = new MultiCast("228.9.6.9", 9999, !isserver);
        }


        public Stream getInputStream()
        {
            if (isserver)
                return server.getInputStream();
            else
                return client.getInputStream();
        }


        public Stream getOutputStream()
        {
            if (isserver)
                return client.getOutputStream();
            return server.getOutputStream();
        }
    }
}